<!DOCTYPE html>
<html>
    <head>
	<meta charset="UTF-8">
        {include="style"}
    </head>
    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>{fun JZLANG('首页')}</cite></a>
              <a><cite>{fun JZLANG('系统扩展')}</cite></a>
              <a><cite>{fun JZLANG('桌面管理')}</cite></a>
              
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="{fun JZLANG('刷新')}"><i class="iconfont" style="line-height:30px">&#xe6aa;</i></a>
        </div>
        <div class="x-body">
        
          <xblock>
		  {if(checkAction('Index/desktop_add'))}
		 <button class="layui-btn layui-btn-sm" onclick="x_admin_show('{fun JZLANG('新增配置')}','{fun U('Index/desktop_add')}')"><i class="layui-icon"></i>{fun JZLANG('新增配置')}</button>
		  {/if}
		   <span class="x-right" style="line-height:40px">{fun JZLANG('共有数据：')}{$sum} {fun JZLANG('条')}</span>
		  </xblock>
            <table class="layui-table">
                <thead>
                    <tr>
                        
                        <th>
                            ID
                        </th>
                       
                        <th>
                            {fun JZLANG('桌面名称')}
                        </th>
						<th>
                            {fun JZLANG('适用角色')}
                        </th>
						<th>
                            {fun JZLANG('系统')}
                        </th>
						<th>
                            {fun JZLANG('是否默认')}
                        </th>
						<th>
                            {fun JZLANG('备注')}
                        </th>
                        <th width="240px">
                            {fun JZLANG('操作')}
                        </th>
                    </tr>
                </thead>
                <tbody id="x-link">
				  {foreach $lists as $v}
                    <tr>
                     
                        <td>
                            {$v['id']}
                        </td>
                        
                        <td>
                            {$v['name']}
                        </td>
						
						<td>
                         {if($v['gid']==0)}{fun JZLANG('所有角色')}{else}{fun get_info_table('level_group',array('id'=>$v['gid']),'name')}
						 {/if}
                        </td>
						<td class="td-status" >
						{if($v['sys']==1)}<span class="layui-badge layui-bg-gray">{fun JZLANG('是')}</span>{else}<span class="layui-badge layui-bg-orange">{fun JZLANG('否')}</span>{/if}
						 </td>
						<td class="td-status" >
						{if($v['isdefault']==1)}<span class="layui-badge layui-bg-gray">{fun JZLANG('是')}</span>{else}<span class="layui-badge layui-bg-orange">{fun JZLANG('否')}</span>{/if}
						 </td>
						<td>
                            {$v['ext']}
                        </td>
                        <td class="td-manage">
                        
							{if(checkAction('Index/desktop_edit'))}
							 <button class="layui-btn layui-btn layui-btn-xs"  onClick="x_admin_show('{fun JZLANG('修改配置')}','{fun U('Index/desktop_edit',array('id'=>$v['id']))}')" ><i class="layui-icon">&#xe642;</i>{fun JZLANG('修改')}</button>
							 <button class="layui-btn layui-btn  layui-btn-warm layui-btn-xs"  onClick="x_admin_show('{fun JZLANG('复制配置')}','{fun U('Index/desktop_edit',array('id'=>$v['id'],'type'=>'copy'))}')" ><i class="layui-icon">&#xe655;</i>{fun JZLANG('复制')}</button>
							{/if}
							{if(checkAction('Index/desktop_del'))}
							 <button class="layui-btn-danger layui-btn layui-btn-xs"  onClick="desktop_del(this,'{$v['id']}')" href="javascript:;" ><i class="layui-icon">&#xe640;</i>{fun JZLANG('删除')}</button>
							{/if}
                        </td>
						
                    </tr>
					{/foreach}
                </tbody>
            </table>
			
            <div class="page">
				{$pages}
			  </div>
        </div>
     
       <script>
	   
	   
	    layui.use(['laydate','element','laypage','layer'], function(){
                $ = layui.jquery;//jquery
              laydate = layui.laydate;//日期插件
              lement = layui.element;//面包导航
            //  laypage = layui.laypage;//分页
              layer = layui.layer;//弹出层

              //以上模块根据需要引入
             
             
              
            });
		 /*删除*/
            function desktop_del(obj,id){
                layer.confirm('{fun JZLANG('确认要删除吗？')}',function(index){
				
					$.get("{fun U('desktop_del')}?id="+id,{},function(s){
						
							var r = JSON.parse(s);
							if(r.code==0){
							 //发异步删除数据
								
								
								layer.msg(r.msg,{icon: 1,time:1000},function(){
									$(obj).parents("tr").remove();
									window.location.reload();
								});
								
								
							}else{
								
								layer.msg(r.msg,{icon: 5,time:1000});
							}
					})
					
				
                   
                });
            }
			
			
			
			
       </script>
    </body>
</html>